All Questions
11 questions
3votes
1answer
268views
Efficiently calculating perfect powers in Haskell
I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell The number 81 has a special property, a certain power of the ...
3votes
0answers
196views
Advent of Code 2021, Day 3 in Haskell
This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal. ...
2votes
0answers
116views
Partial Function composability in Haskell
Below is my solution for the CTFP chapter 4 challenges which essentially involves composing partial functions (that don't have defined outputs for all possible inputs i.e. returning a Maybe). The ...
1vote
1answer
252views
"Sequence full of colors" challenge on HackerRank
This is the challenge: You are given a sequence of N balls in 4 colors: red, green, yellow and blue. The sequence is full of colors if and only if all of the ...
2votes
2answers
102views
HackerRank - Filter huge list for elements that occur more than a given number of times
I'm trying to solve this problem on HackerRank, which basically requires the solution to read an input like this (comments are mine) ...
2votes
1answer
345views
Euler #4: Refined Palindrome in Haskell
This is my attempt at the Problem Euler #4 in Haskell ("Find the largest palindrome made from the product of two 3-digit numbers.") ...
2votes
2answers
383views
Determine whether input-output pairs represent something that could be a proper math function
The input is read in line by line from stdin. Input Format The first line contains an integer, T, denoting the number of test cases. The subsequent lines describe T test cases, and the ...
5votes
1answer
144views
Project Euler problem 11, finding adjacent numbers with the greatest sum
The full description of the problem to solve can be found here. The code I have written works fine but seems extremely verbose for what it's doing, I'm not sure if list comprehensions are meant to be ...
4votes
1answer
1kviews
HackerRank - Candies
Here is the solution I've written for Hacker Rank Candies challenge. It uses dynamic programming (memoization in a boxed array). I'm interested on what could be done to improve this code in term of ...
4votes
1answer
245views
Hackerrank, Service Lane in Haskell
Problem statement Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks....
7votes
4answers
856views
Finding the sum of all the multiples of 3 or 5 below 1000, using list comprehension
I'm trying to compare my own implementation with another solution of Project Euler problem #1, which uses a list comprehension: ...